package com.xm.servlet.background.commodity;

import com.xm.service.background.CommodityService;
import lombok.SneakyThrows;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;



/**
 * 修改商品
 * @author 吴
 * @date 2024年1月5日
 */
@WebServlet("/background/update/commodity/status")
public class UpdateCommodityStatus extends HttpServlet {
    private final CommodityService commodityService = new CommodityService();
    @SneakyThrows(Exception.class)
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) {
        String commodityId = req.getParameter("commodityId");
        String status = req.getParameter("status");
        resp.getWriter().println(commodityService.updateAllSelectedStatus(Integer.parseInt(commodityId)
                ,Integer.parseInt(status)));
    }
}
